import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '卡种名称',
    align: 'center',
    dataIndex: 'cardTypeId_dictText',
    slots: { customRender: 'cardTypeId_dictText' },
  },
  {
    title: '品牌名',
    align: 'center',
    dataIndex: 'brandId_dictText',
    slots: { customRender: 'brandId_dictText' },
  },
  {
    title: '渠道来源',
    align: 'center',
    dataIndex: 'cardSourceId_dictText',
    slots: { customRender: 'cardSourceId_dictText' },
  },
  {
    title: '会员',
    align: 'center',
    dataIndex: 'memberName',
    slots: { customRender: 'memberName' },
  },
  {
    title: '手机号',
    align: 'center',
    dataIndex: 'memberPhone',
    slots: { customRender: 'memberPhone' },
  },
  {
    title: '余额',
    align: 'center',
    dataIndex: 'balance',
  },
  {
    title: '折扣',
    align: 'center',
    dataIndex: 'discount',
    slots: { customRender: 'discount' },
  },
  {
    title: '进货价',
    align: 'center',
    dataIndex: 'buyingPrice',
    slots: { customRender: 'buyingPrice' },
  },
  {
    title: '备注(双击修改)',
    align: 'center',
    dataIndex: 'remark',
    slots: { customRender: 'remark' },
  },
];

export const columns2: BasicColumn[] = [
  {
    title: '品牌名',
    align: 'center',
    dataIndex: 'brandName',
  },
  {
    title: '卡种名称',
    align: 'center',
    dataIndex: 'cardTypeName',
  },
  {
    title: '变动金额',
    align: 'center',
    dataIndex: 'amount',
  },

  {
    title: '余额',
    align: 'center',
    dataIndex: 'balance',
  },

  {
    title: '备注',
    align: 'center',
    dataIndex: 'remark',
  },
  {
    title: '创建时间',
    align: 'center',
    dataIndex: 'createTime',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '品牌名称',
    field: 'brandName',
    component: 'Input',
  },
  {
    label: '渠道来源',
    field: 'cardSourceId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'app_card_source,name,id',
    },
    //colProps: {span: 6},
  },
  {
    label: '会员名称',
    field: 'memberId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'app_member,nick_name,id',
      showSearch: true,
    },
  },
  {
    label: '是否删除',
    field: 'isDel',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'is_del',
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '所属会员',
    field: 'memberId_dictText',
    component: 'Input',
    dynamicDisabled: true,
  },
  // {
  //   label: '卡种标签',
  //   field: 'brandId_dictText',
  //   component: 'Input',
  // },
  {
    label: '折扣',
    field: 'discount',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '库存金额',
    field: 'balance',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '待充金额',
    field: 'amount',
    component: 'Input',
  },
];

// 高级查询数据
export const superQuerySchema = {
  cardTypeId: { title: '卡种id', order: 0, view: 'text', type: 'string' },
  brandId: { title: '品牌id', order: 1, view: 'text', type: 'string' },
  cardSourceId: { title: '渠道来源', order: 2, view: 'list', type: 'string', dictTable: 'app_card_source', dictCode: 'id', dictText: 'name' },
  memberId: { title: '会员id', order: 3, view: 'list', type: 'string', dictTable: 'app_member', dictCode: 'id', dictText: 'nick_name' },
  balance: { title: '余额', order: 4, view: 'number', type: 'number' },
  discount: { title: '折扣', order: 5, view: 'number', type: 'number' },
  buyingPrice: { title: '进货价', order: 6, view: 'number', type: 'number' },
  remark: { title: '备注', order: 7, view: 'text', type: 'string' },
  isDel: { title: '是否删除', order: 8, view: 'number', type: 'number', dictCode: '' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
